<?php defined("APP_VERSION") OR die("No Access"); ?>
      <div class="modebox setup-box setup-basic">
        <div class="hd">
          <h3>基本信息</h3>
          <span class="col-exp">(<i class="col-notice">*</i>为必须填写项)</span> 
        </div>
        <div class="con">
          <p class="col-hints">为了让各位DPer了解你，以下信息将显示在个人资料页（工作地和住处不会显示）。</p>
          <div class="form-box">
            <form action="<?php echo $this->baseUrl('member', 'main');?>" method="post" id="basciForm">
              <ul>
                <li>
                  <div class="tit"><i class="col-notice">*</i>
                    <label>昵称：</label>
                  </div>
                  <div class="f-part">
                    <input name="userNickName" type="text" class="input-plain itxt-s J_ph" maxlength="24" id="J_nickname" placeholder="请输入昵称" value="<?php echo $this->data['basic_info']['nickname']?>" />
                  </div>
                  <div class="f-msg Hide"><span class="m-err"></span></div>
                </li>
                <li>
                  <div class="tit">
                    <label>性别：</label>
                  </div>
                  <div class="f-part f-iradio">
                    <input name="userSex" type="radio" class="radio-plain" value="0" />
                    <label for="">男</label>
                    <input name="userSex" type="radio" class="radio-plain" value="1" />
                    <label for="">女</label>
                  </div>
                </li>
                <li>
                  <div class="tit"><i class="col-notice">*</i>
                    <label for="">常居地：</label>
                  </div>
                  <div class="f-part">
                    <input name="userCityName" type="text" class="input-plain itxt-s J_ph" placeholder="请选择您居住的城市" id="J_user_city" value="<?php echo $this->data['basic_info']['local_city'] ?>"/>
                  </div>
                  <div class="f-msg Hide"><span class="m-err">请填写现居地</span></div>
                </li>
                <li>
                  <div class="tit">
                    <label for="">自我介绍：</label>
                  </div>
                  <div class="f-part">
                    <textarea name="userSign" cols="" rows="5" class="tar-plain J_ph" id="J_sign" placeholder="简单介绍下自己，让更多Dper了解你吧~~" ><?php echo $this->data['basic_info']['brief'] ?></textarea>
                  </div>
                  <div class="f-msg tar-msg Hide"> <span>最多输入150字</span> </div>
                </li>
              </ul>
              <div class="btn-box"> 
                <span class="medi-btn">
                	<button class="btn-txt J_submit" type="submit">保存</button>
                </span>
              </div>
            </form>
          </div>
        </div>
      </div>
      <script type="text/javascript">
      	$('input[name="userSex"]').each(function(i){
			if ($(this).val() == "<?php echo $this->data['basic_info']['sex']?>") $(this).attr('checked', true); 
		});
		
		var basicform = {
			nickname_id : 'J_nickname',
			city_id : 'J_user_city',
			check_name : function() {
				regObj = /^[a-zA-Z0-9\u4e00-\u9fa5]{2,10}$/;
				check_result = regObj.test($('#'+basicform.nickname_id).val());
				message_obj = $('#'+basicform.nickname_id).parent().next();
				if (check_result) {
					message_obj.addClass('Hide');
				} else {
					message_obj.removeClass('Hide');
					message_obj.find('span').css('color', 'red').html('请输入2到10个字符.');
				}
				
				return check_result;
			},
			check_city : function() {
				regObj = /^[a-zA-Z0-9\u4e00-\u9fa5]{2,10}$/;
				check_result = regObj.test($('#'+basicform.city_id).val());
				message_obj = $('#'+basicform.city_id).parent().next();
				if (check_result) {
					message_obj.addClass('Hide');
				} else {
					message_obj.removeClass('Hide');
					message_obj.find('span').css('color', 'red').html('请输入2到10个字符.');
				}
				
				return check_result;
			}
		};
		
		document.getElementById(basicform.nickname_id).onblur = basicform.check_name;
		document.getElementById(basicform.city_id).onblur = basicform.check_city;
		
      	$('#basciForm').submit(function(){
			var submit = true;
			if (!basicform.check_name()) {
				submit = false;
			}
			
			if (!basicform.check_city()) {
				submit = false;
			}
			
			if (submit) {
				form_waitting('表单正在提交,请稍等...');
				$.post($(this).attr('action'), $(this).serialize(), function(reponse) {
					close_from_waitting();
					reponse = eval('('+reponse+')');
					if (reponse.code == 0) {
						form_success(reponse.message);
						$('#member-main').load('<?php echo $this->baseUrl("member", "main");?>');
					} else {
						alert(reponse.message);
					}
				});				
			}
			return false;
		});
      </script>